import { DatePicker } from 'antd'

const { RangePicker } = DatePicker

/*
日期范围选择 RangePickerComponent

          value            当前时间
          onChange         时间发生变化的回调
          disabledDate     不可选择的时间
          placeholder       占位文字

const [dateRange, setDateRange] = useState([])
const onChange = (dates, dateStrings) => {
  console.log('Selected dates:', dates)
  console.log('Date Strings:', dateStrings)
  setDateRange(dates)
}
const disabledDate = current => {
  // Can not select days before today and today
  return current && current.valueOf() < Date.now() - 8.64e7
}

<RangePickerComponent value={dateRange} onChange={onChange} disabledDate={disabledDate} />
*/
const RangePickerComponent = ({
  value,
  onChange,
  disabledDate,
  placeholder = ['开始日期', '结束日期'],
  ...rest
}: any) => {
  return (
    <RangePicker value={value} onChange={onChange} disabledDate={disabledDate} placeholder={placeholder} {...rest} />
  )
}

export default RangePickerComponent
